package main

import "fmt"

func main() {
	// 创建一个存放int类型的channel
	c := make(chan int)

	go func() {
		defer fmt.Println("goroutine over")
		fmt.Println("goroutine is running")

		// 子goroutine将数据传入channel
		c <- 666
	}()

	// main程从channel接收子程的数据
	num := <-c

	fmt.Println("num =", num)
	fmt.Println("main goroutine over")
}
